package com.yp.demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by CrazyMouse on 2017/7/20.
 */
@RestController
public class ShopController {

    @Autowired
    private OAuth2RestTemplate restTemplate;

    @GetMapping("/index")
    public String index() {
        return "this is shop index page";
    }

    @GetMapping("/shop_user")
    public Object getUser() {
        return restTemplate.getForObject("http://microservice-resource/user", Object.class);
    }
}
